<div class="panel panel-default">
    <div class="panel-heading">{{ isset($title) ? $title : "" }}</div>
    <div class="panel-body">
        <canvas id="{!! $name !!}"></canvas>
    </div>
</div>
<script>

    $(function () {
        var ctx = document.getElementById("{!! $name !!}").getContext('2d');
        var data = {
            datasets: [{
                data: [`{!! $correct_count !!}`, `{!! $sum - $correct_count !!}`],
                backgroundColor: [
                        "red",
                        "green"
                ]
            }],

            // These labels appear in the legend and in the tooltips when hovering different arcs
            labels: [
                '正确',
                '错误',
            ]
        };
        var myDoughnut = new Chart(ctx, {
            type: 'doughnut',
            data: data,
            options: {
                rotation: 0
            }
        });

    });
</script>